--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\matt\publications\ajps4\replication\data_analysis\economic_conservatism.log
  log type:  text
 opened on:  11 Oct 2012, 05:35:45

. #delimit ;
delimiter now ;
. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:      economic_conservatism.do                        *;
. *       Date:           October 11, 2012                                *;
. *       Author:         MRG                                             *;
. *       Purpose:        Take economic_conservatism.dta and replicate    *;
. *                       the results in Table 2.                         *;
. *           Input File:     economic_conservatism.dta                       *;
. *       Output File:    economic_conservatism.log                       *;
. *       Data Output:    none                                            *;
.              *       Previous file:  economic_conservatism.dta                       *;
. *       Machine:        laptop                                                          *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. set mem 400m;

Current memory allocation

                    current                                 memory usage
    settable          value     description                 (1M = 1024k)
    --------------------------------------------------------------------
    set maxvar         5000     max. variables allowed           1.947M
    set memory          400M    max. data space                400.000M
    set matsize         400     max. RHS vars in models          1.254M
                                                            -----------
                                                               403.201M

. use "C:\matt\publications\ajps4\replication\data_analysis\economic_conservatism.dta", clear;

. set more off;

. sum;

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        year |    264370    1994.946     5.85372       1981       2004
       ccode |    264370    383.2626    221.2662          2        920
     country |         0
gov_respon~y |    226573     5.64524     3.05514          1         10
 free_market |     13792    .5100783    .4999165          0          1
-------------+--------------------------------------------------------
 inequality1 |     37839    2.135627    1.171327          1          5
attend_rel~s |    249063    4.335658    2.558971          1          8
        wave |    264370    2.951246    .9936813          1          4
         age |    261392    41.18515    16.31476         15        101
highest_ed~n |    184811    4.433659     2.27252          1          8
-------------+--------------------------------------------------------
social_class |    131988    2.667371    .9835625          1          5
income_scale |    225984    4.682708     2.47316          1         10
income_level |    224694    1.954391    .7923673          1          3
        male |    264175    .4814157    .4996555          0          1
inequality~i |    244467    40.99867    9.505983   17.77497     61.819
-------------+--------------------------------------------------------
      region |    264370    7.419272    2.846142          1         10
attendance~l |    211992    8.404166     6.27391          1         24
attendance~e |    213365      19.842    16.56745          1         80
 sub_saharan |    264370    .0637932    .2443846          0          1
  south_asia |    264370    .0465257    .2106211          0          1
-------------+--------------------------------------------------------
   east_asia |    264370    .0513712    .2207541          0          1
     se_asia |    264370    .0223777    .1479089          0          1
     oceania |    264370    .0169346    .1290267          0          1
 middle_east |    264370    .0865113    .2811182          0          1
latin_amer~a |    264370    .1143662    .3182562          0          1
-------------+--------------------------------------------------------
north_amer~a |    264370    .0447138    .2066753          0          1
 east_europe |    264370    .2772743    .4476539          0          1
 west_europe |    264370    .2761319    .4470837          0          1
       wave1 |    264370    .0943261    .2922825          0          1
       wave2 |    264370    .2362863    .4248008          0          1
-------------+--------------------------------------------------------
       wave3 |    264370    .2932027    .4552314          0          1
       wave4 |    264370    .3761849    .4844282          0          1

. desc;

Contains data from C:\matt\publications\ajps4\replication\data_analysis\economic_conservatism.dta
  obs:       264,370                          
 vars:            32                          10 Oct 2012 07:52
 size:    37,540,540 (91.0% of memory free)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
year            int    %8.0g       s020       survey year (s020)
ccode           float  %9.0g                  
country         str48  %48s                   country name
gov_responsib~y byte   %8.0g       e037       government should take less responsibility 1 = yes, 10 = no (reverse of e037)
free_market     byte   %8.0g       e127       free market is right choice 1 = yes, 0 = no (e127)
inequality1     byte   %8.0g       e146       important to reduce inequality 1 = yes, 5 = no (e146)
attend_religi~s byte   %26.0g      relig      how often do you attend religious services (reverse of f028)
wave            byte   %8.0g       s002       survey wave (s002)
age             int    %8.0g       x003       age in years (x003)
highest_educa~n byte   %8.0g       x025       level of education (x025)
social_class    byte   %18.0g      social     self-reported social_class (reverse of x045)
income_scale    byte   %8.0g       x047       income_scale (x047)
income_level    byte   %8.0g       x047r      three levels of income (x047r)
male            float  %9.0g                  female = 0, male = 1
inequality_gini float  %8.0g                  Inequality (gini) by Banones
region          byte   %8.0g                  geographic region (aclp)
attendance_in~l float  %9.0g                  attend_religious_services*income_level
attendance_in~e float  %9.0g                  attend_religious_services*income_scale
sub_saharan     float  %9.0g                  1 = sub-Saharan, 0 otherwise
south_asia      float  %9.0g                  1 = South Asia, 0 otherwise
east_asia       float  %9.0g                  1 = East Asia, 0 otherwise
se_asia         float  %9.0g                  1 = South-East Asia, 0 otherwise
oceania         float  %9.0g                  1 = Oceania, 0 otherwise
middle_east     float  %9.0g                  1 = Middle East, 0 otherwise
latin_america   float  %9.0g                  1 = Latin America, 0 otherwise
north_america   float  %9.0g                  1 = North America, 0 otherwise
east_europe     float  %9.0g                  1 = East Europe, 0 otherwise
west_europe     float  %9.0g                  1 = West Europe, 0 otherwise
wave1           float  %9.0g                  1 = WVS Wave 1, 0 otherwise
wave2           float  %9.0g                  1 = WVS Wave 2, 0 otherwise
wave3           float  %9.0g                  1 = WVS Wave 3, 0 otherwise
wave4           float  %9.0g                  1 = WVS Wave 4, 0 otherwise
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sorted by:  

. *     ****************************************************************  *;
. *       Create a panel ID variable.                                     *;
. *     ****************************************************************  *;
. egen idn=concat(year ccode);

. encode idn, gen(id);

. *     ****************************************************************  *;
. *       Replicate Table 2                                               *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Table 2, Income Inequality -- Additive Model                    *;
. *     ****************************************************************  *;
. gllamm inequality1 attend_religious_services income_level 
>         male age highest_education,  i(id) link(ologit) adapt;

Running adaptive quadrature
Iteration 0:    log likelihood = -41932.014
Iteration 1:    log likelihood = -41816.444
Iteration 2:    log likelihood = -41816.444


Adaptive quadrature has converged, running Newton-Raphson
Iteration 0:   log likelihood = -41816.444  
Iteration 1:   log likelihood = -41816.444  (backed up)
Iteration 2:   log likelihood = -41815.739  
Iteration 3:   log likelihood = -41814.409  
Iteration 4:   log likelihood = -41814.394  
Iteration 5:   log likelihood = -41814.394  
 
number of level 1 units = 31637
number of level 2 units = 31
 
Condition Number = 323.45019
 
gllamm model 
 
log likelihood = -41814.394
 
------------------------------------------------------------------------------
 inequality1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
inequality1  |
attend_rel~s |    .004065   .0049333     0.82   0.410     -.005604    .0137341
income_level |   .2299216   .0142825    16.10   0.000     .2019284    .2579149
        male |   .1610615   .0211303     7.62   0.000     .1196469     .202476
         age |  -.0094338   .0006797   -13.88   0.000     -.010766   -.0081015
highest_ed~n |   .0783196   .0056327    13.90   0.000     .0672797    .0893594
-------------+----------------------------------------------------------------
_cut11       |
       _cons |    .065616   .0872808     0.75   0.452    -.1054512    .2366832
-------------+----------------------------------------------------------------
_cut12       |
       _cons |   1.329463   .0875453    15.19   0.000     1.157877    1.501049
-------------+----------------------------------------------------------------
_cut13       |
       _cons |   2.674757   .0887296    30.15   0.000      2.50085    2.848663
-------------+----------------------------------------------------------------
_cut14       |
       _cons |   3.745934   .0910693    41.13   0.000     3.567442    3.924427
------------------------------------------------------------------------------
 
 
Variances and covariances of random effects
------------------------------------------------------------------------------

 
***level 2 (id)
 
    var(1): .44231037 (.0594614)
------------------------------------------------------------------------------

 

. *     ****************************************************************  *;
. *       Table 2, Income Inequality -- Interactive Model                 *;
. *     ****************************************************************  *;
. gllamm inequality1 attend_religious_services income_level attendance_income_level 
>         male age highest_education, i(id) link(ologit) adapt;

Running adaptive quadrature
Iteration 0:    log likelihood = -41918.993
Iteration 1:    log likelihood = -41801.475
Iteration 2:    log likelihood = -41800.248
Iteration 3:    log likelihood = -41800.179
Iteration 4:    log likelihood = -41798.532
Iteration 5:    log likelihood = -41797.108
Iteration 6:    log likelihood =  -41797.03
Iteration 7:    log likelihood = -41797.027


Adaptive quadrature has converged, running Newton-Raphson
Iteration 0:   log likelihood = -41797.027  
Iteration 1:   log likelihood = -41797.027  (backed up)
Iteration 2:   log likelihood = -41796.904  
Iteration 3:   log likelihood = -41796.904  
 
number of level 1 units = 31637
number of level 2 units = 31
 
Condition Number = 473.03933
 
gllamm model 
 
log likelihood = -41796.904
 
------------------------------------------------------------------------------
 inequality1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
inequality1  |
attend_rel~s |   .0666969   .0118476     5.63   0.000      .043476    .0899179
income_level |    .348728   .0249256    13.99   0.000     .2998746    .3975813
attendance~l |  -.0315608   .0054166    -5.83   0.000    -.0421772   -.0209444
        male |   .1616671   .0211382     7.65   0.000      .120237    .2030973
         age |  -.0096144    .000681   -14.12   0.000    -.0109492   -.0082796
highest_ed~n |   .0795949   .0056416    14.11   0.000     .0685376    .0906522
-------------+----------------------------------------------------------------
_cut11       |
       _cons |   .2208892   .1466773     1.51   0.132    -.0665932    .5083715
-------------+----------------------------------------------------------------
_cut12       |
       _cons |   1.485799   .1469152    10.11   0.000      1.19785    1.773747
-------------+----------------------------------------------------------------
_cut13       |
       _cons |   2.832303   .1476634    19.18   0.000     2.542888    3.121718
-------------+----------------------------------------------------------------
_cut14       |
       _cons |   3.904204   .1490752    26.19   0.000     3.612022    4.196386
------------------------------------------------------------------------------
 
 
Variances and covariances of random effects
------------------------------------------------------------------------------

 
***level 2 (id)
 
    var(1): .52289306 (.13389214)
------------------------------------------------------------------------------

 

.         *     ****************************************************************  *;
. *       Table 2, Government Responsibility -- Additive Model            *;
. *     ****************************************************************  *;
. xtreg gov_responsibility attend_religious_services income_level 
>         male age highest_education, i(id) theta;

Random-effects GLS regression                   Number of obs      =    142993
Group variable: id                              Number of groups   =       116

R-sq:  within  = 0.0098                         Obs per group: min =       325
       between = 0.0077                                        avg =    1232.7
       overall = 0.0098                                        max =      4041

Random effects u_i ~ Gaussian                   Wald chi2(5)       =   1415.03
corr(u_i, X)       = 0 (assumed)                Prob > chi2        =    0.0000

------------------- theta --------------------
  min      5%       median        95%      max
0.8266   0.8751     0.9024     0.9340   0.9501

------------------------------------------------------------------------------
gov_respon~y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
attend_rel~s |   .0077409   .0035168     2.20   0.028     .0008481    .0146337
income_level |   .2152387   .0104582    20.58   0.000     .1947411    .2357364
        male |   .1478134   .0155637     9.50   0.000     .1173091    .1783177
         age |   -.002007   .0005356    -3.75   0.000    -.0030568   -.0009572
highest_ed~n |   .0742455   .0040105    18.51   0.000      .066385     .082106
       _cons |   4.746363   .0938388    50.58   0.000     4.562443    4.930284
-------------+----------------------------------------------------------------
     sigma_u |  .91934586
     sigma_e |  2.9187972
         rho |   .0902547   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Table 2, Government Responsibility -- Interactive Model         *;
. *     ****************************************************************  *;
. xtreg gov_responsibility attend_religious_services income_level attendance_income_level 
>         male age highest_education,  i(id) theta;

Random-effects GLS regression                   Number of obs      =    142993
Group variable: id                              Number of groups   =       116

R-sq:  within  = 0.0099                         Obs per group: min =       325
       between = 0.0073                                        avg =    1232.7
       overall = 0.0099                                        max =      4041

Random effects u_i ~ Gaussian                   Wald chi2(6)       =   1428.53
corr(u_i, X)       = 0 (assumed)                Prob > chi2        =    0.0000

------------------- theta --------------------
  min      5%       median        95%      max
0.8251   0.8741     0.9016     0.9335   0.9497

------------------------------------------------------------------------------
gov_respon~y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
attend_rel~s |   .0347845   .0081883     4.25   0.000     .0187358    .0508333
income_level |   .2774759    .019969    13.90   0.000     .2383375    .3166144
attendance~l |  -.0139343    .003809    -3.66   0.000    -.0213998   -.0064688
        male |   .1468475   .0155653     9.43   0.000     .1163401     .177355
         age |  -.0019802   .0005357    -3.70   0.000    -.0030301   -.0009304
highest_ed~n |   .0748199   .0040134    18.64   0.000     .0669538     .082686
       _cons |   4.621252   .0992642    46.56   0.000     4.426697    4.815806
-------------+----------------------------------------------------------------
     sigma_u |  .91166065
     sigma_e |  2.9186703
         rho |  .08889266   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Table 2, Free Market -- Additive Model                          *;
. *     ****************************************************************  *;
. xtlogit free_market attend_religious_services income_level 
>         male age highest_education, i(id) quad(30);

Fitting comparison model:

Iteration 0:   log likelihood = -8605.0322  
Iteration 1:   log likelihood = -8356.3462  
Iteration 2:   log likelihood = -8356.0475  
Iteration 3:   log likelihood = -8356.0475  

Fitting full model:

tau =  0.0     log likelihood = -8356.0475
tau =  0.1     log likelihood = -8148.9691
tau =  0.2     log likelihood = -8149.3605

Iteration 0:   log likelihood = -8149.4862  
Iteration 1:   log likelihood = -8146.6455  
Iteration 2:   log likelihood = -8146.5994  
Iteration 3:   log likelihood = -8146.5994  

Random-effects logistic regression              Number of obs      =     12416
Group variable: id                              Number of groups   =        10

Random effects u_i ~ Gaussian                   Obs per group: min =       639
                                                               avg =    1241.6
                                                               max =      1707

                                                Wald chi2(5)       =    402.23
Log likelihood  = -8146.5994                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
 free_market |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
attend_rel~s |   .0496325   .0094702     5.24   0.000     .0310712    .0681938
income_level |   .1011092   .0239005     4.23   0.000     .0542651    .1479533
        male |   .2992159   .0380837     7.86   0.000     .2245733    .3738585
         age |  -.0142192   .0012304   -11.56   0.000    -.0166307   -.0118076
highest_ed~n |   .0915661   .0100349     9.12   0.000      .071898    .1112343
       _cons |  -.3266778   .1778073    -1.84   0.066    -.6751737    .0218182
-------------+----------------------------------------------------------------
    /lnsig2u |   -1.57334   .4584969                     -2.471977   -.6747024
-------------+----------------------------------------------------------------
     sigma_u |   .4553587   .1043903                      .2905474    .7136582
         rho |   .0592904   .0255727                       .025018    .1340575
------------------------------------------------------------------------------
Likelihood-ratio test of rho=0: chibar2(01) =   418.90 Prob >= chibar2 = 0.000

. *     ****************************************************************  *;
. *       Table 2, Free Market -- Interactive Model                       *;
. *     ****************************************************************  *;
. xtlogit free_market attend_religious_services income_level attendance_income_level 
>         male age highest_education, i(id) quad(30);

Fitting comparison model:

Iteration 0:   log likelihood = -8605.0322  
Iteration 1:   log likelihood = -8353.7745  
Iteration 2:   log likelihood = -8353.4622  
Iteration 3:   log likelihood = -8353.4622  

Fitting full model:

tau =  0.0     log likelihood = -8353.4622
tau =  0.1     log likelihood = -8143.1307
tau =  0.2     log likelihood = -8143.4225

Iteration 0:   log likelihood = -8143.7682  
Iteration 1:   log likelihood = -8139.7322  
Iteration 2:   log likelihood = -8139.6809  
Iteration 3:   log likelihood = -8139.6808  

Random-effects logistic regression              Number of obs      =     12416
Group variable: id                              Number of groups   =        10

Random effects u_i ~ Gaussian                   Obs per group: min =       639
                                                               avg =    1241.6
                                                               max =      1707

                                                Wald chi2(6)       =    414.47
Log likelihood  = -8139.6808                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
 free_market |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
attend_rel~s |   .1282325    .023191     5.53   0.000     .0827789    .1736861
income_level |   .2501959   .0467444     5.35   0.000     .1585786    .3418132
attendance~l |  -.0413501    .011122    -3.72   0.000    -.0631487   -.0195514
        male |   .2985696   .0381066     7.84   0.000      .223882    .3732572
         age |  -.0142621   .0012315   -11.58   0.000    -.0166758   -.0118485
highest_ed~n |   .0917819   .0100421     9.14   0.000     .0720998    .1114641
       _cons |  -.6148298   .1951551    -3.15   0.002    -.9973268   -.2323328
-------------+----------------------------------------------------------------
    /lnsig2u |  -1.553592   .4582673                      -2.45178   -.6554051
-------------+----------------------------------------------------------------
     sigma_u |    .459877   .1053733                      .2934964    .7205773
         rho |   .0604014   .0260081                      .0255154    .1363135
------------------------------------------------------------------------------
Likelihood-ratio test of rho=0: chibar2(01) =   427.56 Prob >= chibar2 = 0.000

.         *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Replication of Table 2 complete                                 *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
.  *     ****************************************************************  *;
.  *       The End                                                         *;
. *     ****************************************************************  *;
.  *     ****************************************************************  *;
. 
end of do-file

. log close
      name:  <unnamed>
       log:  C:\matt\publications\ajps4\replication\data_analysis\economic_conservatism.log
  log type:  text
 closed on:  11 Oct 2012, 06:27:32
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
